package com.cq.hd.common.enums.biz;

import lombok.Getter;

/**
 * @description: 交易类型(1-订单本金，2-订单补贴，3-本金提现，4-补贴提现，5-本金提现失败退回，6-补贴提现失败退回，7-订单收入)
 * @author: mYunYu
 * @date: 2021/8/23 14:28
 * @version: v1.0
 */
public enum MemberAmtBillTradeTypeEnum {

    ORDER_AMT(1, "订单本金"),
    ORDER_SUBSIDY(2, "订单补贴"),
    WITHDRAWAL_AMT(3, "本金提现"),
    WITHDRAWAL_SUBSIDY(4, "补贴提现"),
    WITHDRAWAL_AMT_FAIL(5, "本金提现失败退回"),
    WITHDRAWAL_SUBSIDY_FAIL(6, "补贴提现失败退回"),
    ORDER_INCOME_AMT(7, "订单收入"),
    ;

    @Getter
    private final Integer value;

    @Getter
    private final String name;

    MemberAmtBillTradeTypeEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    public static MemberAmtBillTradeTypeEnum typeOf(Integer value) {
        MemberAmtBillTradeTypeEnum[] values = MemberAmtBillTradeTypeEnum.values();
        for (MemberAmtBillTradeTypeEnum v : values) {
            if (v.value.equals(value)) {
                return v;
            }
        }
        return null;
    }

    public static MemberAmtBillTradeTypeEnum typeOf(String name) {
        MemberAmtBillTradeTypeEnum[] values = MemberAmtBillTradeTypeEnum.values();
        for (MemberAmtBillTradeTypeEnum v : values) {
            if (v.name.equals(name)) {
                return v;
            }
        }
        return null;
    }

}
